import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      redirect: '/farm/liveBroadCast',
      component: () => import('../views/home/index.vue'),
      children: [
        {
          path: 'farm',
          children: [
            {
              path: 'plantingSchemes',
              component: () => import('../views/farm/PlantingSchemes.vue'),
            },
            {
              path: 'expertHelp',
              component: () => import('../views/farm/ExpertHelp.vue'),
            },
            {
              path: 'liveBroadCast',
              component: () => import('../views/farm/LiveBroadCast.vue'),
            },
          ],
        },
        {
          path: 'warn',
          children: [
            {
              path: 'flood',
              component: () => import('../views/warn/Flood.vue'),
            },
            {
              path: 'mudslide',
              component: () => import('../views/warn/Mudslide.vue'),
            },
            {
              path: 'fire',
              component: () => import('../views/warn/Fire.vue'),
            },
            {
              path: 'earthquake',
              component: () => import('../views/warn/Earthquake.vue'),
            },
          ],
        },
        {
          path: 'law',
          children: [
            {
              path: 'farmer',
              component: () => import('../views/law/Farmer.vue'),
            },
            {
              path: 'civilProcedure',
              component: () => import('../views/law/CivilProcedure.vue'),
            },
          ],
        },
      ],
    },
  ],
})

export default router
